import request from "@/utils/request";
import { AxiosPromise } from "axios";
import { CodeForm, CodeQuery, CodeVO } from "./types";

export function listCodes(queryParams?: CodeQuery): AxiosPromise<CodeVO[]> {
    return request({
        url: "/api/v1/code",
        method: "get",
        params: queryParams,
    });
}
export function addCode(data: CodeForm) {
    return request({
        url: "/api/v1/code",
        method: "post",
        data: data,
    });
}
export function updateCode(id: number, data: CodeForm) {
    return request({
        url: "/api/v1/code/" + id,
        method: "put",
        data: data,
    });
}
export function deleteCode(ids: string) {
    return request({
        url: "/api/v1/code/" + ids,
        method: "delete",
    });
}
